package com.czd.support.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.czd.base.service.BaseService;
import com.czd.support.model.AnswersQuestion;

/**
 * Created with IntelliJ IDEA.
 * Author: Jerry.hu
 * Create: Jerry.hu (2014-10-03 14:58)
 * Description:
 * To change this template use File | Settings | File Templates.
 */
@Service
public class AnswerQuestionService extends BaseService<AnswersQuestion> {

    @Transactional
    public boolean replaceInto(int qId ,int [] aId){
        this.update(sqlId("deleteQA"),qId);
         if(aId.length == 0){
             return true;
         }else{
             Map<String,Object> m = new HashMap<>();
             m.put("qId",qId);
             m.put("aIdArray",aId);
             return this.update(sqlId("batchInsert"),m);
         }
    }
    
    
       /**
	    * 查出问题+答案 明细
	    */ 
	   public   AnswersQuestion  findAQ(int  id){
		     return this.selectOne("findAQ", id);
	   }
}
